package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConParkMemorabiliaUpload;
import com.htgd.gardenexpo.dao.GeConParkMemorabiliaUploadDao;
import com.htgd.gardenexpo.service.GeConParkMemorabiliaUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConParkMemorabiliaUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-06-10 11:07:50
 */
@Service("geConParkMemorabiliaUploadService")
public class GeConParkMemorabiliaUploadServiceImpl implements GeConParkMemorabiliaUploadService {
    @Resource
    private GeConParkMemorabiliaUploadDao geConParkMemorabiliaUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConParkMemorabiliaUpload queryById(Integer id) {
        return this.geConParkMemorabiliaUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConParkMemorabiliaUpload> queryAllByLimit(int offset, int limit) {
        return this.geConParkMemorabiliaUploadDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConParkMemorabiliaUpload> queryByMemorabiliaId(int id) {
        return this.geConParkMemorabiliaUploadDao.queryByMemorabiliaId(id);
    }

    /**
     * 新增数据
     *
     * @param geConParkMemorabiliaUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkMemorabiliaUpload insert(GeConParkMemorabiliaUpload geConParkMemorabiliaUpload) {
        this.geConParkMemorabiliaUploadDao.insert(geConParkMemorabiliaUpload);
        return geConParkMemorabiliaUpload;
    }

    /**
     * 修改数据
     *
     * @param geConParkMemorabiliaUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConParkMemorabiliaUpload update(GeConParkMemorabiliaUpload geConParkMemorabiliaUpload) {
        this.geConParkMemorabiliaUploadDao.update(geConParkMemorabiliaUpload);
        return this.queryById(geConParkMemorabiliaUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConParkMemorabiliaUploadDao.deleteById(id) > 0;
    }

    @Override
    public boolean deleteByMemorabiliaId(Integer id) {
        return this.geConParkMemorabiliaUploadDao.deleteByMemorabiliaId(id) > 0;
    }

    @Override
    public boolean deleteByIds(String[] id,int mid) {
        return this.geConParkMemorabiliaUploadDao.deleteByIds(id,mid) > 0;
    }
}
